//
//  SixViewController.m
//  项目二
//
//  Created by rimi on 16/5/13.
//  Copyright © 2016年 objective. All rights reserved.
//

#import "SixViewController.h"
#import "DataiViewController.h"
@interface SixViewController ()

@end

@implementation SixViewController
//初始化方法，系统创建的视图控制器独有的方法
- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
    }
    return self;
}

#pragma mark -- 视图控制器的生命周期方法

//视图即将出现的时候调用
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    NSLog(@"%@",NSStringFromSelector(_cmd));
}
//视图已经出现的时候调用
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    NSLog(@"%@",NSStringFromSelector(_cmd));
}
//视图即将消失时调用
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    NSLog(@"%@",NSStringFromSelector(_cmd));
}
//视图已经消失时调用
- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    NSLog(@"%@",NSStringFromSelector(_cmd));
}
//视图加载完成时调用
- (void)viewDidLoad {
    [super viewDidLoad];
     NSLog(@"%@",NSStringFromSelector(_cmd));
    self.title = @"视图：UIView、UIImageView、UITextView";
    self.view.backgroundColor = [UIColor whiteColor];
    [self initUImarkViewControllerLabel];
    [self initUIbutton111];
    [self initUIView];
}
-(void)initUIView{
    UIView *redView = [[UIView alloc]initWithFrame:CRM(40, 200, 150, 150)];
    redView.backgroundColor = [UIColor redColor];
    [self.view addSubview:redView];
    
    UIView *blackView = [[UIView alloc]initWithFrame:CGRectMake(110, 270, 150, 150)];
    blackView.backgroundColor = [UIColor blackColor];
    [self.view addSubview:blackView];
    /**改变视图的层级*/
//    [self.view bringSubviewToFront:redView];
//    [self.view sendSubviewToBack:redView];
}

-(void)initUIbutton111{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.bounds = CRM(0, 0, 80, 30);
    button.center = CPM(CGRectGetMidX(self.view.bounds), CGRectGetMaxY(self.view.frame)-50);
    button.backgroundColor= [UIColor orangeColor];
    [button setTitle:@"跳转" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonT:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}

-(void) initUImarkViewControllerLabel{
    //标记当前视图控制器
    UILabel *markViewControllerLabel = [[UILabel alloc]initWithFrame:CRM(0, 0, CGRectGetWidth(self.view.bounds), 80)];
    markViewControllerLabel.backgroundColor = [UIColor redColor];
    markViewControllerLabel.text = @"1";
    markViewControllerLabel.textAlignment = NSTextAlignmentCenter;
    markViewControllerLabel.font = [UIFont systemFontOfSize:16];
    markViewControllerLabel.textColor = [UIColor blackColor];
    [self.view addSubview:markViewControllerLabel];
}
#pragma mark - UIButton
- (void)buttonT:(UIButton *)sender{
    DataiViewController *datai = [[DataiViewController alloc]init];
    /**推送效果*/
//    datai.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    /**模态推送*/
    [self presentViewController:datai animated:YES completion:nil];
}
@end
